import { AppContext } from "../../app.context";
import { AlbumInfo } from "../../mode/album";
import { AlbumService } from "../../services/album.service";

Page({

  /**
   * 页面的初始数据
   */
  data: {
    albums: <AlbumInfo[]>[],
    createName: '',
    isCreate: false,
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad() {
    AlbumService.instance.getList().then(() => {
      const albums = AppContext.instance.resources.album;
      console.log(albums);

      this.setData({ albums });
    })
  },
  onShow() {
    AppContext.instance.setTabbarActive(1);
    this.getTabBar().init();
  },

  onCreate(): void {
    this.setData({ isCreate: !this.data.isCreate });
  }

})